package p2shapesv3;

public class Rectangle extends Shape {
	private float length;
	private float width;
	
	public Rectangle(){
		super();
		length = width = 0;
	}

	public Rectangle(float l, float w){
		if (l >= 0)
			length = l;
		if (w >= 0)
			width  = w;
	}

	public float getLength(){
		return length;
	}

	public void setLength(float l){
		if (l >= 0)
			length = l;
	}
	
	public void setWidth(float w){
		if (w >= 0)
			width = w;
	}

	public String toString(){
		return " length: " + length + ", width: " + width + super.toString();
	}

	@Override
	public float getPerimeter() {
		return 2.0f * ( length + width );
	}

	@Override
	public float getArea() {
		return length * width;
	}
}